﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ElingOA6_Admin_DSJCJ.BLL
{
    public class CdLeaveReason
    {
        private readonly ElingOA6_Admin_DSJCJ.DAL.CdLeaveReason dal = new ElingOA6_Admin_DSJCJ.DAL.CdLeaveReason();
        public CdLeaveReason()
        { }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<ElingOA6_Admin_DSJCJ.Model.CdLeaveReason> DataTableToList(DataTable dt)
        {
            List<ElingOA6_Admin_DSJCJ.Model.CdLeaveReason> modelList = new List<ElingOA6_Admin_DSJCJ.Model.CdLeaveReason>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                ElingOA6_Admin_DSJCJ.Model.CdLeaveReason model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<ElingOA6_Admin_DSJCJ.Model.CdLeaveReason> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ElingOA6_Admin_DSJCJ.Model.CdLeaveReason GetModel(string FLeaveReasonCd)
        {

            return dal.GetModel(FLeaveReasonCd);
        }

        /// 增加一条数据
        /// </summary>
        public bool Add(ElingOA6_Admin_DSJCJ.Model.CdLeaveReason model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ElingOA6_Admin_DSJCJ.Model.CdLeaveReason model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string FLeaveReasonCd)
        {

            return dal.Delete(FLeaveReasonCd);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool DeleteList(string FLeaveReasonCdlist)
        {
            return dal.DeleteList(FLeaveReasonCdlist);
        }


    }
}
